#include<bits/stdc++.h>
#define XH(i,a,b) for(int i=a;i<b;++i)
#define XXH(i,a,b) for(int i=a-1;i>=b;--i)
#define LL long long
using namespace std;
int tmpINT; string tmpSTRING; char tmpCHAR; double tmpDOUBLE; LL tmpLONGLONG;
struct node
{
	int coinHave;
	int minLevel;
	set<node>children;
	bool operator<(const node b) const{
		return this->minLevel < b.minLevel;
	}
};

vector<node>arr;

int cnt0 = 0, cnt1 = 0;

void dfs(int num){
    
}

int main(){
	int n;cin>>n;
  arr.resize(n+1);
	XH(i , 1 , n+1){
    arr[i].minLevel = 1;
    arr[i].coinHave = 1;
  }
	XH(i , 2 , n+1){
		scanf("%d", &tmpINT);
		arr[tmpINT].children.insert(arr[i]);
		arr[tmpINT].minLevel = arr[i].children.begin()->minLevel+1;
	}
  dfs(i);
	
	return 0;
}
